﻿//  Write a program that calculates for given N how many trailing zeros present at the end of the number N!. Examples:
//	N = 10 -> N! = 3628800 -> 2
//	N = 20 -> N! = 2432902008176640000 -> 4
//	Does your program work for N = 50 000?
//	Hint: The trailing zeros in N! are equal to the number of its prime divisors of value 5. Think why!

using System;

class TrailingZeroesInFactorial
{
    static void Main()
    {
        Console.Write("Enter N to find the trailing zeroes in N! : ");
        int numberN = int.Parse(Console.ReadLine());

        int trailingZeroes = 0;
        int divider = 5;

        while (numberN / divider >= 1)
        {
            trailingZeroes += numberN / divider;
            divider *= 5;
        }

        Console.WriteLine("The trailing zeroes of {0}! are {1}.", numberN, trailingZeroes);
    }
}
